/*
 * Copyright 2012 weiwen.
 *
 * Licensed under the Apache License and Weibo License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.weiwen.net;


/**
 * Encapsulation a Weiwen error, when Weiwen request can not be implemented successful.
 *
 * @author  SuChangli (changlisu@gmail.com)
 */
public class WeiWenException extends Exception {
	 
	private static final long serialVersionUID = -9212796864232800621L;
	/*304 Not Modified: 没有数据返回.
	400 Bad Request: 请求数据不合法，或超过请求频率限制. 
	404 Not Found: 请求的资源不存在.
	500 Internal Server Error: 服务器内部错 
	503 Service Unavailable: 服务端资源不可用.
	*/
	
	private int statusCode = -1;
	
	
    public WeiWenException(String msg) {
        super(msg);
    }

    public WeiWenException(Exception cause) {
        super(cause);
    }

    public WeiWenException(String msg, int statusCode) {
        super(msg);
        this.statusCode = statusCode;
    }

    public WeiWenException(String msg, Exception cause) {
        super(msg, cause);
    }

    public WeiWenException(String msg, Exception cause, int statusCode) {
        super(msg, cause);
        this.statusCode = statusCode;
    }

    public int getStatusCode() {
        return this.statusCode;
    }
    
    
	public WeiWenException() {
		super(); 
	}

	public WeiWenException(String detailMessage, Throwable throwable) {
		super(detailMessage, throwable);
	}

	public WeiWenException(Throwable throwable) {
		super(throwable);
	}

	public WeiWenException(int statusCode) {
		super();
		this.statusCode = statusCode;
	}

	public void setStatusCode(int statusCode) {
		this.statusCode = statusCode;
	}
	
}
